package jinyilw.tools.net.dev;

import java.io.IOException;
import java.io.OutputStream;

public class PipedOutputStream extends OutputStream
{

	private PipedInputStream input;

	public PipedOutputStream()
	{

	}

	public void connect(PipedInputStream input)
	{
		this.input = input;
	}

	public void write(int b) throws IOException
	{
		this.input.receive(b);
	}

	public void write(byte[] b, int off, int len) throws IOException
	{
		for (int i = off; i < off + len; i++)
		{
			this.write(b[i]);
		}
	}

	public void write(byte[] b) throws IOException
	{
		this.write(b, 0, b.length);
	}
}
